<template>
    <div>
        <!-- 面包屑导航 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/getCheck' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: '/getCheck' }">机构信息核审</el-breadcrumb-item>
            <el-breadcrumb-item>审核</el-breadcrumb-item>
        </el-breadcrumb>

        <el-container>
            <el-row style="text-align: right;font-size: medium">
                <el-col :span="5">
                    <span>统一社会信用代码：</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.orgId}}</span>
                </el-col>
                <el-col :span="5">
                    <span>机构名称：</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.orgName}}</span>
                </el-col>

                <el-col :span="5">
                    <span>法定代表人：</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.legalName}}</span>
                </el-col>

                <el-col :span="5">
                    <span>法定代表人证件号：</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.legalIdcard}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">注册地址：
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.orgAddr}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">联系方式：
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.mobile}}</span>
                </el-col>

                <el-col :span="5">
                    <div class="grid-content bg-purple">联系人姓名：
                    </div>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.contactName}}</span>
                </el-col>

                <el-col :span="5">
                    <span class="grid-content bg-purple">联系人身份证号：</span>
                </el-col>
                <el-col :span="6" style="text-align: left;">
                    <span>{{this.$route.params.contIdcard}}</span>
                </el-col>


                <el-col :span="5">
                    <span class="grid-content bg-purple">营业执照：</span>
                </el-col>
                <el-col :span="19">
                        <span style="height: 150px">
                        <vue-preview :slides="slide1" class="preview" alt=""></vue-preview>
                        </span>
                </el-col>


                <el-col :span="5">
                    <span class="grid-content bg-purple">法人证件：</span>
                </el-col>
                <el-col :span="19">
                        <span style="height: 150px">
                        <vue-preview :slides="slide2" class="preview" alt=""></vue-preview>
                        </span>
                </el-col>

                <el-col :span="5">
                    <span class="grid-content bg-purple">联系人身份证：</span>
                </el-col>
                <el-col :span="19">
                        <span style="height: 150px">
                        <vue-preview :slides="slide3" class="preview" alt=""></vue-preview>
                        </span>
                </el-col>
            </el-row>
        </el-container>
        <el-divider/>
        <el-form :inline="true" :model="orgInfo" ref="orgInfo" class="paper-search" style="margin-top: 20px">
            <el-input
                    type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4}"
                    placeholder="请输入审核意见"
                    v-model="orgInfo.remark">
            </el-input>

            <div style="margin-top: 10px;margin-right: 30px;text-align: right">
                <span>
                    审核结果：
                    <el-button size="small" style="text-align: right" type="success" @click="pass(orgInfo)"
                               icon="el-icon-check" circle/>
                    <el-button size="small" style="text-align: right" type="danger" @click="refuse(orgInfo)"
                               icon="el-icon-close" circle/>
                </span>

            </div>
        </el-form>
    </div>
</template>

<script>

    import {check} from "../../../api/orgBaseMG";

    export default {
        name: "check",
        data() {
            return {
                orgInfo: {
                    remark: '',
                    status: '',
                    slide1:[],
                    slide2: [],
                    slide3: []
                }

            }
        },
        methods: {
            pass(orgInfo) {
                this.$confirm('企业信息审核通过', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    console.log("===============>", orgInfo);
                    const params = {
                        orgId:this.$route.params.orgId,
                        remark: this.orgInfo.remark,
                        status: '2'
                    };
                    check(params).then(res=>{
                        console.log("res====>",res);
                        if(res.code === 200) {
                            this.$router.push("GetCheck");
                            this.$message({
                                type: 'success',
                                message: '审核成功!'
                            });
                        }
                    });

                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
                });
            },
            refuse(orgInfo) {
                this.$confirm('企业信息审核不通过', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    console.log("orgInfo===============>", orgInfo);
                    let params = {
                        orgId:this.$route.params.orgId,
                        remark: this.orgInfo.remark,
                        status: '0'
                    };
                    console.log("params====>",params);
                    check(params).then(res=>{
                        if(res.code === 200) {
                            this.$router.push("GetCheck");
                            this.$message({
                                type: 'success',
                                message: '审核成功!'
                            });
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消'
                    });
                });
            }
        },
        created() {
            console.log("orgInfo====>",JSON.parse(window.localStorage.getItem('ORG_INFO')));

            let temp = {
                src: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).orgFilePath,
                msrc: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).orgFilePath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide1 = [temp];
            console.log("slide1",this.slide1);
            let temp2 = {
                src: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).legalIdPath,
                msrc: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).legalIdPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide2 = [temp2];
            let temp3 = {
                src: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).contPath,
                msrc: "http://localhost:8082/" + JSON.parse(window.localStorage.getItem('ORG_INFO')).contPath,
                w: 1200,// 大图宽
                h: 900
            };
            this.slide3 = [temp3];
        }
    }

</script>

<style scoped>

    .el-container {
        margin-top: 20px;
        text-align: center;
        font-size: 14px;
        line-height: 50px;
    }

</style>